<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FabGL: vgacontroller.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">FabGL
   </div>
   <div id="projectbrief">ESP32 VGA Controller and Graphics Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('vgacontroller_8cpp.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#namespaces">Namespaces</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">vgacontroller.cpp File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;Arduino.h&quot;</code><br />
<code>#include &lt;alloca.h&gt;</code><br />
<code>#include &lt;stdarg.h&gt;</code><br />
<code>#include &lt;math.h&gt;</code><br />
<code>#include &lt;string.h&gt;</code><br />
<code>#include &quot;freertos/FreeRTOS.h&quot;</code><br />
<code>#include &quot;freertos/task.h&quot;</code><br />
<code>#include &quot;soc/i2s_struct.h&quot;</code><br />
<code>#include &quot;soc/i2s_reg.h&quot;</code><br />
<code>#include &quot;driver/periph_ctrl.h&quot;</code><br />
<code>#include &quot;rom/lldesc.h&quot;</code><br />
<code>#include &quot;soc/rtc.h&quot;</code><br />
<code>#include &quot;<a class="el" href="utils_8h_source.html">utils.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="vgacontroller_8h_source.html">vgacontroller.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="swgenerator_8h_source.html">swgenerator.h</a>&quot;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:namespacefabgl"><td class="memItemLeft" align="right" valign="top"> &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacefabgl.html">fabgl</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a99fd799e4538ae36990684edff6eef05"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vgacontroller_8cpp.html#a99fd799e4538ae36990684edff6eef05">RED_BIT</a>&#160;&#160;&#160;0</td></tr>
<tr class="separator:a99fd799e4538ae36990684edff6eef05"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a32dc889471fbe291d00248a1749c354a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vgacontroller_8cpp.html#a32dc889471fbe291d00248a1749c354a">GREEN_BIT</a>&#160;&#160;&#160;2</td></tr>
<tr class="separator:a32dc889471fbe291d00248a1749c354a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9b16e31073123c83aad7ce9dd60fc572"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vgacontroller_8cpp.html#a9b16e31073123c83aad7ce9dd60fc572">BLUE_BIT</a>&#160;&#160;&#160;4</td></tr>
<tr class="separator:a9b16e31073123c83aad7ce9dd60fc572"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a77bdf15ef53de85932fb2778377dfb0a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vgacontroller_8cpp.html#a77bdf15ef53de85932fb2778377dfb0a">HSYNC_BIT</a>&#160;&#160;&#160;6</td></tr>
<tr class="separator:a77bdf15ef53de85932fb2778377dfb0a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad234f23c4b3d93e28801870484e4ba20"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vgacontroller_8cpp.html#ad234f23c4b3d93e28801870484e4ba20">VSYNC_BIT</a>&#160;&#160;&#160;7</td></tr>
<tr class="separator:ad234f23c4b3d93e28801870484e4ba20"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a808014ec64474d3eb229b5d987704529"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vgacontroller_8cpp.html#a808014ec64474d3eb229b5d987704529">SYNC_MASK</a>&#160;&#160;&#160;((1 &lt;&lt; <a class="el" href="vgacontroller_8cpp.html#a77bdf15ef53de85932fb2778377dfb0a">HSYNC_BIT</a>) | (1 &lt;&lt; <a class="el" href="vgacontroller_8cpp.html#ad234f23c4b3d93e28801870484e4ba20">VSYNC_BIT</a>))</td></tr>
<tr class="separator:a808014ec64474d3eb229b5d987704529"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad1a2a0c20aee0d1d72585d83f4f9a63a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vgacontroller_8cpp.html#ad1a2a0c20aee0d1d72585d83f4f9a63a">PIXELINROW</a>(row,  X)&#160;&#160;&#160;(row[((X) &amp; 0xFFFC) + ((2 + (X)) &amp; 3)])</td></tr>
<tr class="separator:ad1a2a0c20aee0d1d72585d83f4f9a63a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a471eb089050a39f7ea634deb42449a7c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vgacontroller_8cpp.html#a471eb089050a39f7ea634deb42449a7c">PIXEL</a>(X,  Y)&#160;&#160;&#160;<a class="el" href="vgacontroller_8cpp.html#ad1a2a0c20aee0d1d72585d83f4f9a63a">PIXELINROW</a>(m_viewPort[(Y)], X)</td></tr>
<tr class="separator:a471eb089050a39f7ea634deb42449a7c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac884b107c90b9a3d8de40f2262e27b6a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vgacontroller_8cpp.html#ac884b107c90b9a3d8de40f2262e27b6a">CHECKEDSETPIXEL</a>(X,  Y,  value)</td></tr>
<tr class="separator:ac884b107c90b9a3d8de40f2262e27b6a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a487056e25e63d9473578efefd590020a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classfabgl_1_1_v_g_a_controller_class.html">fabgl::VGAControllerClass</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="vgacontroller_8cpp.html#a487056e25e63d9473578efefd590020a">VGAController</a></td></tr>
<tr class="separator:a487056e25e63d9473578efefd590020a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9976da0aa55db0059548b3c98e449993"><td class="memItemLeft" align="right" valign="top">RGB&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacefabgl.html#a9976da0aa55db0059548b3c98e449993">fabgl::COLOR2RGB</a> [16]</td></tr>
<tr class="separator:a9976da0aa55db0059548b3c98e449993"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a9b16e31073123c83aad7ce9dd60fc572"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9b16e31073123c83aad7ce9dd60fc572">&#9670;&nbsp;</a></span>BLUE_BIT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define BLUE_BIT&#160;&#160;&#160;4</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="ac884b107c90b9a3d8de40f2262e27b6a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac884b107c90b9a3d8de40f2262e27b6a">&#9670;&nbsp;</a></span>CHECKEDSETPIXEL</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define CHECKEDSETPIXEL</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">X, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">Y, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">value&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">{ \</div><div class="line">                                       int x = (X), y = (Y);  \</div><div class="line">                                       if (x &gt;= 0 &amp;&amp; x &lt; m_viewPortWidth &amp;&amp; y &gt;= 0 &amp;&amp; y &lt; m_viewPortHeight)  \</div><div class="line">                                         PIXEL(x, y) = (value);  \</div><div class="line">                                     }</div></div><!-- fragment -->
</div>
</div>
<a id="a32dc889471fbe291d00248a1749c354a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a32dc889471fbe291d00248a1749c354a">&#9670;&nbsp;</a></span>GREEN_BIT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define GREEN_BIT&#160;&#160;&#160;2</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a77bdf15ef53de85932fb2778377dfb0a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a77bdf15ef53de85932fb2778377dfb0a">&#9670;&nbsp;</a></span>HSYNC_BIT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define HSYNC_BIT&#160;&#160;&#160;6</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a471eb089050a39f7ea634deb42449a7c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a471eb089050a39f7ea634deb42449a7c">&#9670;&nbsp;</a></span>PIXEL</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define PIXEL</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">X, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">Y&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;<a class="el" href="vgacontroller_8cpp.html#ad1a2a0c20aee0d1d72585d83f4f9a63a">PIXELINROW</a>(m_viewPort[(Y)], X)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="ad1a2a0c20aee0d1d72585d83f4f9a63a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad1a2a0c20aee0d1d72585d83f4f9a63a">&#9670;&nbsp;</a></span>PIXELINROW</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define PIXELINROW</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">row, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">X&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;(row[((X) &amp; 0xFFFC) + ((2 + (X)) &amp; 3)])</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a99fd799e4538ae36990684edff6eef05"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a99fd799e4538ae36990684edff6eef05">&#9670;&nbsp;</a></span>RED_BIT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RED_BIT&#160;&#160;&#160;0</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a808014ec64474d3eb229b5d987704529"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a808014ec64474d3eb229b5d987704529">&#9670;&nbsp;</a></span>SYNC_MASK</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define SYNC_MASK&#160;&#160;&#160;((1 &lt;&lt; <a class="el" href="vgacontroller_8cpp.html#a77bdf15ef53de85932fb2778377dfb0a">HSYNC_BIT</a>) | (1 &lt;&lt; <a class="el" href="vgacontroller_8cpp.html#ad234f23c4b3d93e28801870484e4ba20">VSYNC_BIT</a>))</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="ad234f23c4b3d93e28801870484e4ba20"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad234f23c4b3d93e28801870484e4ba20">&#9670;&nbsp;</a></span>VSYNC_BIT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define VSYNC_BIT&#160;&#160;&#160;7</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="a487056e25e63d9473578efefd590020a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a487056e25e63d9473578efefd590020a">&#9670;&nbsp;</a></span>VGAController</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classfabgl_1_1_v_g_a_controller_class.html">fabgl::VGAControllerClass</a> VGAController</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="vgacontroller_8cpp.html">vgacontroller.cpp</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
